﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>OOP</title>
    <script type="text/javascript">
        /*
        var object = {

            // catch住不能响应消息的系统信号
            __noSuchMethod__: function (name, args) {
                alert([name, args]);
                if (name == 'test') {
                    return '.test() method is handled';
                }
                return delegate[name].apply(this, args);
            }

        };

        var delegate = {
            square: function (a) {
                return a * a;
            }
        };

      
        alert(object.square(10)); // 100
        alert(object.test()); // .test() method is handled
        */


        function test() {
            alert([this.a, this.b]);
        }

        test.call({ a: 10, b: 20 }); // 10, 20
        test.call({ a: 100, b: 200 }); // 100, 200

        var a = 1;
        var b = 2;

    

        a = 100;

        test(); // 1, 2

    </script>
</head>
<body>
    <div>
        OOP
    </div>
</body>
</html>
